package com.aaa.hospital.controller;

import com.aaa.hospital.aop.Log;
import com.aaa.hospital.pojo.domain.Kes;
import com.aaa.hospital.pojo.query.KesQuery;
import com.aaa.hospital.result.AjaxResult;
import com.aaa.hospital.service.KesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: danghui
 * @Date: 2022/1/10 17:24
 * @Description: TODO
 */
@RestController
@RequestMapping("kes")
public class kesController {
    @Autowired
    private KesService kesService;

    @RequestMapping("list")
    public AjaxResult list(){
        return kesService.listAllKes();
    }

    @RequestMapping("query")
    public AjaxResult query(KesQuery query){
        return kesService.listKes(query);
    }

    @RequestMapping("delete/{id}")
    @Log("删除科室")
    public AjaxResult delete(@PathVariable("id") Integer id){
        return kesService.deleteKes(id);
    }

    @RequestMapping("add")
    @Log("添加科室")
    public AjaxResult add(Kes kes){
        return kesService.addKes(kes);
    }
    @RequestMapping("getKes/{id}")
    public AjaxResult getKes(@PathVariable("id") Integer id){
        return kesService.getKes(id);
    }

    @RequestMapping("update")
    @Log("修改科室")
    public AjaxResult update(Kes kes){
        System.out.println(kes);
        return kesService.updateKes(kes);
    }
}
